define(function(require, exports, module) {
    /**
     * 根据传入的日期格式字符串，返回特定日期
     * @param {string} rule - 日期格式字符串
     */
    module.exports = function(rule) {
        var fixZero = require('fmtStr').fixPreZero;

        var date = new Date(),
            ruleTemp = {
                y: date.getFullYear(),
                M: fixZero(date.getMonth() + 1),
                d: fixZero(date.getDate()),
                h: fixZero(date.getHours()),
                m: fixZero(date.getMinutes()),
                s: fixZero(date.getSeconds())
            };

        if (rule && typeof rule === 'string') {
            for (var key in ruleTemp) {
                if (ruleTemp.hasOwnProperty(key)) {
                    rule = rule.replace(key, ruleTemp[key]);
                }
            }
        } else {
            rule = [ruleTemp.y, ruleTemp.M, ruleTemp.d];
            rule = rule.join('-');
        }

        return rule;
    }
});